//package com.njcky.service.impl;
//
//import cn.hutool.core.bean.BeanUtil;
//import com.alibaba.fastjson.JSON;
//import com.google.common.collect.Lists;
//import com.njcky.model.*;
//import com.njcky.model.dto.*;
//import com.njcky.model.vo.CrossSectionAnalysisVo;
//import com.njcky.model.vo.SectionAnalysisVo;
//import com.njcky.utils.citylife.AesUtil;
//import com.njcky.utils.citylife.exception.CustomException;
//import com.njcky.utils.db.DBHelper;
//import com.njcky.utils.njssmx.TreeUtil;
//import com.njcky.utils.page.StringUtils;
//import com.yutu.map.service.model.GeoCompareModel;
//import org.geotools.geometry.jts.JTSFactoryFinder;
//import org.locationtech.jts.geom.*;
//import org.locationtech.jts.geom.GeometryFactory;
//import org.locationtech.jts.io.WKTReader;
//import org.locationtech.jts.io.ParseException;
//import org.locationtech.jts.io.WKTReader;
//import org.springframework.stereotype.Service;
//import org.springframework.util.CollectionUtils;
//
//import org.springframework.beans.BeanUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
//import org.springframework.stereotype.Service;
//import org.springframework.util.ObjectUtils;
//
//import java.math.BigDecimal;
//import java.math.MathContext;
//import java.math.RoundingMode;
//import java.sql.Connection;
//import java.sql.SQLException;
//import java.util.*;
//import java.util.concurrent.*;
//import java.util.stream.Collectors;
//
//@Service
//public class JianJunRoadDemoServiceImpl implements JianJunRoadDemoService {
//
//    @Value("${pgLink.url}")
//    String pgUrl;
//    @Value("${pgLink.username}")
//    String pgUserName;
//    @Value("${pgLink.password}")
//    String pgPassword;
//    @Value("${map.status}")
//    private boolean status;
//    @Value("${map.srid}")
//    private Integer srid;
//    /**
//     * int
//     */
//    public static final int INT = 2;
//    /**
//     * int1
//     */
//    public static final int INT1 = 180;
//    /**
//     * 瓦尔
//     */
//    public static final int VAL = 110771;
//
//    /**
//     * 线程池任务执行程序
//     */
//    @Qualifier("threadPoolExecutor")
//    @Autowired
//    private ThreadPoolTaskExecutor threadPoolTaskExecutor;
//
//
//    @Override
//    public List<Map<String, Object>> getviewptlist(String vname, String userid) {
//        List<Map<String, Object>> resultMap = new ArrayList<>();
//        String sql = "";
//        vname = vname == null ? "" : vname;
//        String where = "";
//        if (!StringUtils.isEmpty(vname)) {
//            where = " and vname like '%" + vname + "%' ";
//        }
//        if (!StringUtils.isEmpty(userid)) {
//            where = where + " and userid ='" + userid + "' ";
//        }
//        sql = "SELECT id, vname, vpos, remark, tmppic, zorder, posttime, userid  FROM njssmx_sjgl.screen_viewpoint where 1=1  " + where + " order by posttime";
//        resultMap = DBHelper.NpgNormal_GetListDic(sql, pgUrl, pgUserName, pgPassword);
//        return resultMap;
//    }
//
//    @Override
//    public int saveviewpt(View view) {
//        String id = UUID.randomUUID().toString();
//        String sql = String.format("INSERT INTO njssmx_sjgl.screen_viewpoint(id, vname, vpos, remark, tmppic, zorder, posttime, userid) VALUES( '%s','%s','%s','%s','%s',%d,cast (current_timestamp(0) as  timestamp without time zone),'%s')", id, view.getVname(), view.getVpos(), view.getRemark(), view.getTmppic(), view.getZorder(), view.getUserid());
//        return DBHelper.NpgNormal_ExecutorNonQuery(sql, pgUrl, pgUserName, pgPassword);
//    }
//
//    @Override
//    public int delviewpt(String id) {
//        String sql = String.format("delete  FROM njssmx_sjgl.screen_viewpoint where id='%s' ", id);
//        return DBHelper.NpgNormal_ExecutorNonQuery(sql, pgUrl, pgUserName, pgPassword);
//    }
//
//    @Override
//    public List<Map<String, Object>> getroutelist(Route route) {
//        List<Map<String, Object>> resultMap = new ArrayList<>();
//        String sql = "";
//        String where = "";
//        if (!StringUtils.isEmpty(route.getRouteName())) {
//            where = " and route_name like '%" + route.getRouteName() + "%' ";
//        }
//        sql = "SELECT *  FROM njssmx_sjgl.zhyy_route_record where 1=1  " + where + " order by create_time";
//        resultMap = DBHelper.NpgNormal_GetListDic(sql, pgUrl, pgUserName, pgPassword);
//        return resultMap;
//    }
//
//
//    @Override
//    public int saveroute(Route route) {
//        String id = UUID.randomUUID().toString();
//        // 获取当前时间戳
//        String timestamp = String.valueOf(System.currentTimeMillis()); // 当前时间戳
//        String sql = String.format("INSERT INTO njssmx_sjgl.zhyy_route_record(id, route_name, route_point, create_time, note, route_user) VALUES( '%s','%s','%s',cast (current_timestamp(0) as  timestamp without time zone),'%s','%s')", timestamp, route.getRouteName(), route.getRoutePoint(), route.getNote(), route.getRouteUser());
//        return DBHelper.NpgNormal_ExecutorNonQuery(sql, pgUrl, pgUserName, pgPassword);
//    }
//
//    // 生成ASSIGN_ID的方法
//    public static String generateAssignId() {
//        // 获取当前时间戳
//        String timestamp = String.valueOf(System.currentTimeMillis()); // 当前时间戳
//        // 生成一个随机UUID
//        String randomUUID = UUID.randomUUID().toString(); // 随机UUID
//        // 去掉UUID中的"-"
//        randomUUID = randomUUID.replaceAll("-", ""); // 移除UUID中的字符"-"
//
//        // 拼接时间戳和随机数，生成ASSIGN_ID
//        String assignId = timestamp + randomUUID.substring(0, 6); // 前6个字符
//
//        return assignId; // 返回生成的ASSIGN_ID
//    }
//
//
//    @Override
//    public int delroute(String id) {
//        String sql = String.format("delete  FROM njssmx_sjgl.zhyy_route_record where id='%s' ", id);
//        return DBHelper.NpgNormal_ExecutorNonQuery(sql, pgUrl, pgUserName, pgPassword);
//    }
//
//    @Override
//    public List<LabelResDto> queryRangeByLabel(InParamDto inParamDto) {
//        List<Map<String, Object>> resultMap = new ArrayList<>();
//        List<LabelResDto> resultRecipientList = Lists.newArrayList();
//        String sql = "";
//        String where = "";
////        //        //        System.out.println(sql);(inParamDto.getIds());
//        if (!ObjectUtils.isEmpty(inParamDto.getIds()) && inParamDto.getIds().size() > 0) {
//            //where= " and FIND_IN_SET(id,"+inParamDto.getIds().toString().replace("[","'").replace("]","'")+")";
//            where = "and cast(id as text)  = ANY ( STRING_TO_ARRAY(" + inParamDto.getIds().toString().replace("[", "'").replace("]", "'").replace(" ", "") + ", ',' ) )";
//        }
//        sql = "SELECT *  FROM njssmx_sjgl.sys_result_tem where note like concat('%','LINE','%') " + where;
////        sql = "SELECT *  FROM njssmx_sjgl.sys_result_tem where note like concat('%','line','%') "+where;
////        //        //        System.out.println(sql);(sql);
//        resultMap = DBHelper.NpgNormal_GetListDic(sql, pgUrl, pgUserName, pgPassword);
//        //javaBean是实体类
//        List<SysInParamPo> list = resultMap.stream()
//                .map(map -> JSON.parseObject(JSON.toJSONString(map), SysInParamPo.class))
//                .collect(Collectors.toList());
//        if (!ObjectUtils.isEmpty(list) && list.size() > 0) {
//            list.forEach(info -> {
//                if (!StringUtils.isEmpty(info.getNote())) {
//                    String key;
//                    if (status) {
//                        key = "njssmx_sjgl." + info.getNote();
////                        key = "postgres." + info.getNote();
//                    } else {
//                        key = "njssmx_sjgl." + info.getNote();
//                        //key = "postgres." + info.getNote();
//                    }
//                    info.setKey(key);
//                    ////        //        System.out.println(sql);("shape:"+inParamDto.getShape());
//                    info.setShape(inParamDto.getShape());
//
//                    if (!ObjectUtils.isEmpty(inParamDto.getBufferRange())) {
//                        info.setBufferRange(BigDecimal.valueOf(inParamDto.getBufferRange()));
//                    }
//                }
//            });
//            List<SysInParamPo> list1 = list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(()
//                    -> new TreeSet<>(Comparator.comparing(SysInParamPo::getKey))), ArrayList::new));
//            ////        //        System.out.println(sql);(list1);
//            // 每10条数据开启一条线程
//            int threadSize = 5;
//            // 总数据条数
//            int dataSize = list1.size();
//            // 线程数
//            int threadNum = dataSize / threadSize + 1;
//            // 计数器
//            CountDownLatch countDownLatch = new CountDownLatch(threadNum);
//            // 定义标记,过滤threadNum为整数
//            boolean special = dataSize % threadSize == 0;
//            // 创建一个线程池
//            ExecutorService exec = Executors.newFixedThreadPool(threadNum);
//            // 定义一个任务集合
//            List<Callable<Boolean>> tasks = Lists.newArrayList();
//            // 定义一个任务
//            Callable<Boolean> task;
//            // 定义循环处理的i批次数据
//            List<SysInParamPo> loopDataList;
//            // 确定每条线程的数据
//            for (int i = 0; i < threadNum; i++) {
//                if (i == threadNum - 1) {
//                    if (special) {
//                        countDownLatch.countDown();
//                        break;
//                    }
//                    loopDataList = list1.subList(threadSize * i, dataSize);
//                } else {
//                    loopDataList = list1.subList(threadSize * i, threadSize * (i + 1));
//                }
//                // 当前循环处理的数据集
//                List<SysInParamPo> recipientInfoDTOS = loopDataList;
//                task = new Callable<Boolean>() {
//                    @Override
//                    public Boolean call() throws Exception {
//                        if (!ObjectUtils.isEmpty(recipientInfoDTOS)) {
//                            for (SysInParamPo recipientInfo : recipientInfoDTOS) {
//                                // TODO 业务逻辑处理
//                                //构建查询
//                                //List<ResultByLineDto> result = rangeMapper.selectTableByLabelShape(recipientInfo);
//                                String sql = "SELECT  PUBLIC.st_astext (PUBLIC.st_intersection ( A.shape, b.shape ) ) intersectPoint,A.*,PUBLIC.st_astext(a.shape) as shapeText FROM " + recipientInfo.getKey() +
//                                        " as a, ( select PUBLIC.ST_GeomFromText(" + recipientInfo.getShape() + ",0) as shape) b WHERE PUBLIC.st_astext (PUBLIC.st_intersection ( A.shape, b.shape ) ) NOT LIKE'%EMPTY%'";
////                                //        //        System.out.println(sql);(recipientInfo.getId() + ":" + sql);
//                                List<ResultByLineDto> result = DBHelper.NpgNormal_GetListDic(sql, pgUrl, pgUserName, pgPassword).stream()
//                                        .map(map -> JSON.parseObject(JSON.toJSONString(map), ResultByLineDto.class))
//                                        .collect(Collectors.toList());
////                                //        //        System.out.println(sql);(result);
//                                if (!ObjectUtils.isEmpty(result)) {
//                                    LabelResDto tableResDto = new LabelResDto();
//                                    tableResDto.setKey(recipientInfo.getKey());
//                                    tableResDto.setList(result);
//                                    resultRecipientList.add(tableResDto);
//                                }
//                            }
//                        }
//                        return false;
//                    }
//                };
//                // 减少计数器的计数，如果计数达到零，则释放所有等待线程。
//                // 如果当前计数大于零，则递减。如果新计数为零，则重新启用所有等待线程以进行线程调度。
//                countDownLatch.countDown();
//                // 任务处理完加入集合
//                tasks.add(task);
//            }
//            try {
//                // 执行给定的任务，返回一个 Futures 列表，在所有完成时保存它们的状态和结果。
//                // Future.isDone对于返回列表的每个元素都是true 。
//                // 请注意，已完成的任务可能已经正常终止，也可能通过引发异常终止。
//                // 如果在此操作进行时修改了给定的集合，则此方法的结果是不确定的
//                exec.invokeAll(tasks);
//                // 等待计数器归零
//                countDownLatch.await();
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
//            exec.shutdown();
//        }
//        return resultRecipientList;
//    }
//
//    @Override
//    public GuidResDto queryRangeByClick(ClickDto clickDto) {
//        String last = null;
//        String res = clickDto.getList().get(0);
//        if (res.equals("pipeLine")) {
//            last = "line";
//        } else if (res.equals("pipePoint")) {
//            last = "point";
//        }
//        QueryGuidDto info = new QueryGuidDto();
//        String guid = clickDto.getList().get(1);
//        String table = clickDto.getList().get(2);
//
//        info.setGuid(guid);
//
//        String key;
//        if (status) {
////            key = "njssmx_sjgl." + table + "_" + last;
//            key = "postgres." + table + "_" + last;
//        } else {
////            key = "njssmx_sjgl." + table + "_" + last;
//            key = "postgres." + table + "_" + last;
//        }
//        info.setKey(key);
//        //ResultByLineDto result = rangeMapper.selectByGuid(info);
//        String sql = "SELECT  A.*,sde.st_astext(a.shape) as shapeText FROM " + info.getKey() +
//                " as a where 1=1 and  bsm ='" + info.getGuid() + "'";
////        //        //        System.out.println(sql);(sql);
//        ResultByLineDto result = BeanUtil.mapToBean(DBHelper.NpgNormal_GetListDicNo1(sql, pgUrl, pgUserName, pgPassword), ResultByLineDto.class, true);
//        GuidResDto guidResDto = new GuidResDto();
//        guidResDto.setKey(res);
//        guidResDto.setInfo(result);
//        return guidResDto;
//    }
//
//    @Override
//    public List<Map<String, Object>> lyfx(NodeInfo nodeInfo) {
//        List<String> objectids = new ArrayList<>();
//        List<Map<String, Object>> objects = new ArrayList<>();
//        boolean bo = true;
//        String strError = "";
//        try {
//            objectids = LYFX(nodeInfo, strError);
//            if (!strError.equals("")) {
//                //log.error("LYFX", "获取错误问题！", strError);
//                bo = false;
//            }
//            if (!objectids.isEmpty()) {
//                String mode = "postgres.";
//                String sql = String.format("select a.*,sde.st_astext(shape) as shapeText,a.xzq as ssqy,a.zydw as tcdw from " + mode + "%1$s as a where %2$s in (%3$s) ", nodeInfo.getLineTable(), nodeInfo.getObjectid(), String.join(",", objectids.toArray(new String[0])));
////                //        //        System.out.println(sql);(sql);
//                objects = DBHelper.NpgNormal_GetListDic(sql, pgUrl, pgUserName, pgPassword);
//            }
//        } catch (RuntimeException ex) {
//            bo = false;
//            //log.error("SetIdStatus:" + ex.getMessage(), ex.getLocalizedMessage());
//            ex.printStackTrace();
//        }
//        return objects;
//    }
//
//
////    @Override
////    public List<Map<String, Object>> connectivity(NodeInfo nodeInfo) {
////        List<String> objectids = new ArrayList<>();
////        List<Map<String, Object>> objects = new ArrayList<>();
////        // 固定线表名称为"ps_wsg_line"（从入参lineTable获取的值）
////        String lineTableOne = "ps_wsg_line";
////        // 固定objectid字段名为"objectid"（从入参objectid获取的值）
////        String objectIdField = "objectid";
////        try {
////            // 只使用strNodeIdOne和strNodeIdTwo作为参数，其他参数固定
////            objectids = FindPath(
////                    nodeInfo.getStrNodeIdOne(),
////                    nodeInfo.getStrNodeIdTwo(),
////                    lineTableOne,
////                    nodeInfo  // 保留nodeInfo参数，确保FindPath方法能正常工作
////            );
////            if (objectids.isEmpty()) {
////                return null;
////            }
////            // 固定使用postgres模式
////            String mode = "postgres.";
////            String sql = String.format(
////                    "select *,xzq as ssqy,zydw as tcdw,sde.st_length(shape) as length from " + mode + "%1$s where %2$s in (%3$s) ",
////                    lineTableOne,
////                    objectIdField,  // 使用固定的objectid字段名
////                    String.join(",", objectids.toArray(new String[0]))
////            );
////            objects = selectMap(sql, nodeInfo);
////            //        //        System.out.println(sql);(sql);
////        } catch (RuntimeException ex) {
////            ex.printStackTrace();
////        }
////        return objects;
////    }
//
//    @Override
//    public List<Map<String, Object>> connectivity(NodeInfo nodeInfo) {
//        List<String> objectids = new ArrayList<>();
//        List<Map<String, Object>> objects = new ArrayList<>();
//        List<String> lineTable = nodeInfo.getLineTable();
//        String lineTableOne = lineTable.get(0);
//        try {
//            objectids = FindPath(nodeInfo.getStrNodeIdOne(), nodeInfo.getStrNodeIdTwo(), lineTableOne, nodeInfo);
//            if (objectids.isEmpty()) {
//                return null;
//            }
//            String mode = "postgres.";
//            String sql = String.format("select *,xzq as ssqy,zydw as tcdw,sde.st_length(shape) as length from " + mode + "%1$s where %2$s in (%3$s) ", lineTableOne,
//                    nodeInfo.getObjectid(), String.join(",", objectids.toArray(new String[0])));
//            objects = selectMap(sql, nodeInfo);
////            //        //        System.out.println(sql);("postgres.connectivity"+sql);
//        } catch (RuntimeException ex) {
//            //        //        System.out.println(sql);("服务出现异常，请检查");
//            ex.printStackTrace();
//        }
//        return objects;
//    }
//
//
//    @Override
//    public List<SysInParamPo> queryByTreeList(InParamDto inParamDto) {
//        //坐标转换
//        if (!StringUtils.isEmpty(inParamDto.getShape())) {
//            inParamDto.setShape(getCoordinate4549(inParamDto.getShape()));
//        }
////        //        //        System.out.println(sql);(inParamDto);
//        List<SysInParamDto> ids = getParams(inParamDto);
////        //        //        System.out.println(sql);("ids:" + ids);
//        if (!ObjectUtils.isEmpty(ids) && ids.size() > 0) {
//            ids.forEach(info -> {
//                if (!StringUtils.isEmpty(info.getNote())) {
//                    String key;
//                    if (status) {
//                        //key = "njssmx_sjgl." + info.getNote();
//                        key = "postgres." + info.getNote();
//                    } else {
//                        //key = "njssmx_sjgl." + info.getNote();
//                        key = "postgres." + info.getNote();
//                    }
//                    info.setKey(key);
//                    info.setShape(inParamDto.getShape());
//                    info.setBufferRange(inParamDto.getBufferRange());
//                    info.setIsPublic(inParamDto.getIsPublic());
//                    info.setUpDown(inParamDto.getUpDown());
//                    if (!StringUtils.isEmpty(inParamDto.getResult())) {
//                        //Aes解密
//                        String sql = AesUtil.decrypt(inParamDto.getResult());
//                        info.setResult(sql);
//                    }
//                }
//            });
//        }
//        List<SysInParamDto> id = ids.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(()
//                -> new TreeSet<>(Comparator.comparing(SysInParamDto::getNote))), ArrayList::new));
////        //        //        System.out.println(sql);("id:::" + id);
//        Future<String> future = this.executeAsyncTask(id, inParamDto);
//        String result = null; // 这将会阻塞直到异步任务完成并获取结果
//
//        List<TableResDto> resultRecipientList = new ArrayList<>();
//        try {
//            result = future.get();
////            //        //        System.out.println(sql);("result:" + result);
//            resultRecipientList = JSON.parseArray(result, TableResDto.class);
//        } catch (InterruptedException | ExecutionException e) {
//            e.printStackTrace();
//        }
//        List<TableResDto> collect = resultRecipientList.stream().filter(s -> s != null && s.getKey() != null
//                && !Objects.equals(s.getKey(), "")).collect(Collectors.toList());
//        List<TableResDto> collect1 = collect.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(()
//                -> new TreeSet<>(Comparator.comparing(TableResDto::getKey))), ArrayList::new));
//        List<SysInParamPo> res = getTree(collect1, inParamDto);
//        //根据任意字段筛选
////        for(SysInParamPo sp:res){
////            if(sp.getChildren()!=null){
////                sp.setChildren(sp.getChildren().stream().filter(c->inParamDto.getId()==c.getId()).collect(Collectors.toList()));
////            }
////
////        }
////        List<SysInParamPo> res2=new ArrayList<>();
////        if (inParamDto.getId() != null) {
////            //res=res.stream().filter(r -> r.getId()==inParamDto.getId()).collect(Collectors.toList());
////            if (res.stream().filter(r -> r.getId() == inParamDto.getId()).collect(Collectors.toList()).isEmpty()) {
////                for (SysInParamPo sp : res) {
////                    if (sp.getChildren() != null) {
////                        sp.setChildren(sp.getChildren().stream().filter(c -> inParamDto.getId() == c.getId()).collect(Collectors.toList()));
////                        if(!sp.getChildren().stream().filter(c -> inParamDto.getId() == c.getId()).collect(Collectors.toList()).isEmpty()){
////                            res2.add(sp);
////                        }
////
////                    }
////                }
////                return res2;
////            }
////        }
////        if(inParamDto.getVa){
////            res=res.stream().filter(r -> r.getId()==inParamDto.getId()).collect(Collectors.toList());
////        }
//        //        //        System.out.println(sql);("res:" + res);
//        return res;
//    }
//
//
//    @Override
//    public List<Map<String, Object>> queryDetailByTreeList(InParamDto inParamDto) {
//        //坐标转换
//        if (!StringUtils.isEmpty(inParamDto.getShape())) {
//            inParamDto.setShape(getCoordinate4549(inParamDto.getShape()));
//        }
////        //        //        System.out.println(sql);(inParamDto);
//        //参数优化:表明转换成id
//        inParamDto.setIds(tableParse(inParamDto.getTables()));
//        List<SysInParamDto> ids = getParams(inParamDto);
////        //        //        System.out.println(sql);("ids:" + ids);
//        if (!ObjectUtils.isEmpty(ids) && ids.size() > 0) {
//            ids.forEach(info -> {
//                if (!StringUtils.isEmpty(info.getNote())) {
//                    String key;
//                    if (status) {
//                        //key = "njssmx_sjgl." + info.getNote();
//                        key = "postgres." + info.getNote();
//                    } else {
//                        //key = "njssmx_sjgl." + info.getNote();
//                        key = "postgres." + info.getNote();
//                    }
//                    info.setKey(key);
//                    info.setShape(inParamDto.getShape());
//                    info.setBufferRange(inParamDto.getBufferRange());
//                    info.setIsPublic(inParamDto.getIsPublic());
//                    info.setUpDown(inParamDto.getUpDown());
//                    if (!StringUtils.isEmpty(inParamDto.getResult())) {
//                        //Aes解密
//                        String sql = AesUtil.decrypt(inParamDto.getResult());
//                        info.setResult(sql);
//                    }
//                }
//            });
//        }
//        List<SysInParamDto> id = ids.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(()
//                -> new TreeSet<>(Comparator.comparing(SysInParamDto::getNote))), ArrayList::new));
////        //        //        System.out.println(sql);("id:::" + id);
//        List<Map<String, Object>> result = new ArrayList<>();
//        for (SysInParamDto sysInParamDto : id) {
//            String sql = "SELECT A.*, a.xzq as ssqy,a.zydw as tcdw,sde.st_astext(a.shape) as shapeText FROM " + sysInParamDto.getKey() + " as a where 1=1 ";
//
//            if (StringUtils.isNotEmpty(sysInParamDto.getShape())) {
//                if (sysInParamDto.getBufferRange() == null) {
//                    sysInParamDto.setBufferRange(0);
//                }
////                //        //        System.out.println(sql);("sysInParamDto.getShape():" + sysInParamDto.getShape());
//                sql = sql + " and  sde.st_intersects(shape,sde.st_buffer(sde.st_geometry('" + sysInParamDto.getShape() + "'," + srid + ")," + sysInParamDto.getBufferRange() + "))";
//            }
//
//            //任意字段的模糊查询功能
//            if (!StringUtils.isEmpty(inParamDto.getVagueQueryParam())) {
////                //        //        System.out.println(sql);(sysInParamDto.getKey());
//                String[] str = sysInParamDto.getKey().split("\\.");
//                String schema = str[0];
//                String tableName = str[1];
//                //查询所有列
//                String colSql = "select column_name from information_schema.columns\n" +
//                        "where table_schema='" + schema + "' and table_name='" + tableName + "' and column_name!='shape' ;";
//                List<Map<String, Object>> colList = DBHelper.NpgNormal_GetListDic(colSql, pgUrl, pgUserName, pgPassword);
//                String whereSql = " and (";
//                //循环遍历
////                //        //        System.out.println(sql);(colList);
//                for (int i = 0; i < colList.size(); i++) {
//                    if (i == colList.size() - 1) {
//                        whereSql = whereSql + "   CAST(a." + colList.get(i).get("column_name").toString() + " AS TEXT) like concat('%','" + inParamDto.getVagueQueryParam() + "','%') )";
//                    } else {
//                        whereSql = whereSql + "   CAST(a." + colList.get(i).get("column_name").toString() + " AS TEXT) like concat('%','" + inParamDto.getVagueQueryParam() + "','%') or ";
//                    }
//
//                }
////                //        //        System.out.println(sql);(whereSql);
//                sql = sql + whereSql;
//            }
//            //历史查询(基于管线时间属性,查询时间字段区间数据)
//            if (!StringUtils.isEmpty(inParamDto.getHistoryQueryDataTimeParam()) && !StringUtils.isEmpty(inParamDto.getStartQueryParamValue()) && !StringUtils.isEmpty(inParamDto.getEndQueryParamValue())) {
//                sql = sql + " and a." + inParamDto.getHistoryQueryDataTimeParam() + " between '" + inParamDto.getStartQueryParamValue() + "' and '" + inParamDto.getEndQueryParamValue() + "'";
//            }
////            //        //        System.out.println(sql);("timeSql: " + sql);
//            //指定任意字段和值查询
//            if (!StringUtils.isEmpty(inParamDto.getHistoryQueryParam()) && !StringUtils.isEmpty(inParamDto.getHistoryQueryParamValue())) {
//                //遍历参数集合
//                for (int i = 0; i < inParamDto.getHistoryQueryParam().size(); i++) {
//                    sql = sql + " and  CAST(a." + inParamDto.getHistoryQueryParam().get(i) + " AS TEXT) like concat('%','" + inParamDto.getHistoryQueryParamValue().get(i) + "','%')";
//                }
////                sql=sql+" and  CAST(a."+inParamDto.getHistoryQueryParam()+" AS TEXT) like concat('%','"+inParamDto.getHistoryQueryParamValue()+"','%')";
//            }
//
//
////            //        //        System.out.println(sql);(sql);
//            List<Map<String, Object>> sqlResult = DBHelper.NpgNormal_GetListDic(sql, pgUrl, pgUserName, pgPassword);
//            for (Map<String, Object> m : sqlResult) {
////                if(StringUtils.isNotEmpty(m.get("shapetext").toString())){
////                    m.put("shapetext",getCoordinateJWD(m.get("shapetext").toString()));
////                }
//                result.add(m);
//            }
//        }
//
////        //        //        System.out.println(sql);(result);
//        return result;
//    }
//
//    @Override
//    public Map<String, Object> queryRangeByBuffer(QueryBufferDto queryBufferDto) {
//        if (StringUtils.isNotEmpty(queryBufferDto.getShape())) {
//            queryBufferDto.setShape(getCoordinate4549(queryBufferDto.getShape()));
//        }
//        String sql = "SELECT  sde.st_astext( sde.st_buffer(sde.st_geometry('" + queryBufferDto.getShape() + "'," + srid + ")," + queryBufferDto.getBuffer() + "))";
////        //        //        System.out.println(sql);(sql);
//        Map<String, Object> result = DBHelper.NpgNormal_GetListDicNo1(sql, pgUrl, pgUserName, pgPassword);
////        //        //        System.out.println(sql);(result);
//        if (StringUtils.isNotEmpty(result.get("st_astext").toString())) {
//            //将结果转换成他们要的经纬度格式
//            String sqlStr = "select st_astext( st_transform(sde.st_geometry('" + result.get("st_astext").toString() + "',4528), 4490))";
//            result = DBHelper.NpgNormal_GetListDicNo1(sqlStr, pgUrl, pgUserName, pgPassword);
//        }
//        return result;
//    }
//
//    @Override
//    public List<Map<String, Object>> timeFieldQuery() {
//        List<Map<String, Object>> resultMap = new ArrayList<>();
//        resultMap.add(new HashMap<String, Object>() {{
//            put("jsnd", "建设年代");
//        }});
//        resultMap.add(new HashMap<String, Object>() {{
//            put("tcrq", "探测日期");
//        }});
//        return resultMap;
//    }
//
//    @Override
//        public List<Map<String, Object>> attributeSearch(InParamDto inParamDto) {
//        //坐标转换
//        if (!StringUtils.isEmpty(inParamDto.getShape())) {
//            inParamDto.setShape(getCoordinate4549(inParamDto.getShape()));
//        }
//        inParamDto.setIds(tableParse(inParamDto.getTables()));
//        List<SysInParamDto> ids = getParams(inParamDto);
//        if (!ObjectUtils.isEmpty(ids) && ids.size() > 0) {
//            ids.forEach(info -> {
//                if (!StringUtils.isEmpty(info.getNote())) {
//                    String key;
//                    if (status) {
//                        key = "postgres." + info.getNote();
//                    } else {
//                        key = "postgres." + info.getNote();
//                    }
//                    info.setKey(key);
//                    info.setShape(inParamDto.getShape());
//                    info.setBufferRange(inParamDto.getBufferRange());
//                    info.setIsPublic(inParamDto.getIsPublic());
//                    info.setUpDown(inParamDto.getUpDown());
//                    if (!StringUtils.isEmpty(inParamDto.getResult())) {
//                        //Aes解密
//                        String sql = AesUtil.decrypt(inParamDto.getResult());
//                        info.setResult(sql);
//                    }
//                }
//            });
//        }
//        List<SysInParamDto> id = ids.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(()
//                -> new TreeSet<>(Comparator.comparing(SysInParamDto::getNote))), ArrayList::new));
//        List<Map<String, Object>> result = new ArrayList<>();
//        for (SysInParamDto sysInParamDto : id) {
//            String sql = "SELECT A.*, a.xzq as ssqy,a.zydw as tcdw,sde.st_astext(a.shape) as shapeText FROM " + sysInParamDto.getKey() + " as a where 1=1 ";
//            if (StringUtils.isNotEmpty(sysInParamDto.getShape())) {
//                if (sysInParamDto.getBufferRange() == null) {
//                    sysInParamDto.setBufferRange(0);
//                }
//                sql = sql + " and  sde.st_intersects(shape,sde.st_buffer(sde.st_geometry('" + sysInParamDto.getShape() + "'," + srid + ")," + sysInParamDto.getBufferRange() + "))";
//            }
//            //任意字段的模糊查询功能
//            if (!StringUtils.isEmpty(inParamDto.getVagueQueryParam())) {
//                String[] str = sysInParamDto.getKey().split("\\.");
//                String schema = str[0];
//                String tableName = str[1];
//                //查询所有列
//                String colSql = "select column_name from information_schema.columns\n" +
//                        "where table_schema='" + schema + "' and table_name='" + tableName + "' and column_name!='shape' ;";
//                List<Map<String, Object>> colList = DBHelper.NpgNormal_GetListDic(colSql, pgUrl, pgUserName, pgPassword);
//                String whereSql = " and (";
//                for (int i = 0; i < colList.size(); i++) {
//                    if (i == colList.size() - 1) {
//                        whereSql = whereSql + "   CAST(a." + colList.get(i).get("column_name").toString() + " AS TEXT) like concat('%','" + inParamDto.getVagueQueryParam() + "','%') )";
//                    } else {
//                        whereSql = whereSql + "   CAST(a." + colList.get(i).get("column_name").toString() + " AS TEXT) like concat('%','" + inParamDto.getVagueQueryParam() + "','%') or ";
//                    }
//
//                }
//                sql = sql + whereSql;
//            }
//            //历史查询(基于管线时间属性,查询时间字段区间数据)
//            if (!StringUtils.isEmpty(inParamDto.getHistoryQueryDataTimeParam()) && !StringUtils.isEmpty(inParamDto.getStartQueryParamValue()) && !StringUtils.isEmpty(inParamDto.getEndQueryParamValue())) {
//                sql = sql + " and a." + inParamDto.getHistoryQueryDataTimeParam() + " between '" + inParamDto.getStartQueryParamValue() + "' and '" + inParamDto.getEndQueryParamValue() + "'";
//            }
//            //指定任意字段和值查询
//            if (!StringUtils.isEmpty(inParamDto.getHistoryQueryParam()) && !StringUtils.isEmpty(inParamDto.getHistoryQueryParamValue())) {
//                //遍历参数集合
//                for (int i = 0; i < inParamDto.getHistoryQueryParam().size(); i++) {
//                    sql = sql + " and  CAST(a." + inParamDto.getHistoryQueryParam().get(i) + " AS TEXT) like concat('%','" + inParamDto.getHistoryQueryParamValue().get(i) + "','%')";
//                }
//            }
//
//            List<Map<String, Object>> sqlResult = DBHelper.NpgNormal_GetListDic(sql, pgUrl, pgUserName, pgPassword);
//            for (Map<String, Object> m : sqlResult) {
//                result.add(m);
//            }
//        }
//        return result;
//    }
//
//    //移除树形结构中的地上地下和公共非公共层级
//    private List<SysInParamPo> reBuild(List<SysInParamPo> data) {
//        List<SysInParamPo> result = new ArrayList<>();
//        //管点管线
//        data.forEach(v -> {
//            SysInParamPo root = new SysInParamPo();
//            BeanUtils.copyProperties(v, root);
//            List<SysInParamPo> buildBigType = new ArrayList<>();
//            List<SysInParamPo> dsdx = v.getChildren();
//            //地上地下
//            dsdx.forEach(dd -> {
//                List<SysInParamPo> gf = dd.getChildren();
//                //公共非公共
//                gf.forEach(dl -> {
//                    List<SysInParamPo> bigType = dl.getChildren();
//                    //大类
//                    bigType.forEach(fl -> {
//                        String name = fl.getValue();
//                        Optional<SysInParamPo> first = buildBigType.stream().filter(j -> j.getValue().equals(name)).findFirst();
//                        if (first.isPresent()) {
//                            SysInParamPo bType = first.get();
//                            bType.setCount(bType.getCount() + fl.getCount());
//                            //小类
//                            List<SysInParamPo> flData = fl.getChildren();
//                            bType.getChildren().forEach(h -> {
//                                String sName = h.getValue();
//                                Optional<SysInParamPo> sData = flData.stream().filter(j -> j.getValue().equals(sName)).findFirst();
//                                if (sData.isPresent()) {
//                                    SysInParamPo ss = sData.get();
//                                    h.setCount(h.getCount() + ss.getCount());
//                                }
//                            });
//                        } else {
//                            buildBigType.add(fl);
//                        }
//                    });
//                });
//            });
//            root.setChildren(buildBigType);
//            result.add(root);
//        });
//        return result;
//    }
//
//    private List<SysInParamPo> getTree(List<TableResDto> resultRecipientList, InParamDto inParamDto) {
//
//        //List<SysInParamPo> list = sysInParamService.list();
//        String sql = "SELECT *  FROM njssmx_sjgl.sys_result_tem ";
//
//        List<Map<String, Object>> resultMap = DBHelper.NpgNormal_GetListDic(sql, pgUrl, pgUserName, pgPassword);
//        List<SysInParamPo> list = resultMap.stream()
//                .map(map -> JSON.parseObject(JSON.toJSONString(map), SysInParamPo.class))
//                .collect(Collectors.toList());
//        ;
//        List<SysInParamPo> treeList = TreeUtil.buildTree(list, 1);
//        List<SysInParamPo> sys = getData(treeList, resultRecipientList, inParamDto);
//        sys = reBuild(sys);
//        return new ArrayList<>(sys);
//    }
//
//    private List<SysInParamDto> getParams(InParamDto inParamDto) {
//        List<Integer> ids = inParamDto.getIds();
//        String getIds = inParamDto.getIds().toString().replace("[", "").replace("]", "");
//        String sql = "SELECT *  FROM njssmx_sjgl.sys_node_relation where node_id_point in(" + getIds + ")";
////        //        //        System.out.println(sql);(sql);
//        List<Map<String, Object>> resultMap = DBHelper.NpgNormal_GetListDic(sql, pgUrl, pgUserName, pgPassword);
//        List<NodePo> list = resultMap.stream()
//                .map(map -> JSON.parseObject(JSON.toJSONString(map), NodePo.class))
//                .collect(Collectors.toList());
//        ;
//        List<Integer> lineList = list.stream().
//                map(NodePo::getNodeIdLine).collect(Collectors.toList());
//        List<Integer> roomList = list.stream().
//                map(NodePo::getNodeIdRoom).collect(Collectors.toList());
//        ids.addAll(lineList);
//        ids.addAll(roomList);
////        //        //        System.out.println(sql);("ids" + ids);
//        List<Integer> sysIds = getIds(ids);
////        //        //        System.out.println(sql);("sysIds" + sysIds);
//        if (!ObjectUtils.isEmpty(sysIds) && sysIds.size() > 0) {
//            //return rangeMapper.selectTableById(sysIds);
//
//            String sql2 = "select id,value,parent_id as parentId,note,sort,is_show as isShow from njssmx_sjgl.sys_result_tem as a ";
//            if (sysIds != null && sysIds.size() > 0) {
//                String sysIdss = sysIds.toString().replace("[", "").replace("]", "");
//                sql2 = sql2 + " where a.id in(" + sysIdss + ")";
//            }
////            //        //        System.out.println(sql);(sql2);
//            List<Map<String, Object>> resultMap2 = DBHelper.NpgNormal_GetListDic(sql2, pgUrl, pgUserName, pgPassword);
//            return resultMap2.stream()
//                    .map(map -> JSON.parseObject(JSON.toJSONString(map), SysInParamDto.class))
//                    .collect(Collectors.toList());
//        }
//        return new ArrayList<>();
//    }
//
//    private List<Integer> getIds(List<Integer> ids) {
////        List<SysInParamPo> sysInParamPoList = sysInParamService.list(Wrappers.<SysInParamPo>lambdaQuery()
////                .in(SysInParamPo::getId, ids));
//        String getIds = ids.toString().replace("[", "").replace("]", "");
//        String sql = "SELECT *  FROM njssmx_sjgl.sys_result_tem where id in(" + getIds + ")";
////        //        //        System.out.println(sql);(sql);
//        List<Map<String, Object>> resultMap = DBHelper.NpgNormal_GetListDic(sql, pgUrl, pgUserName, pgPassword);
//        List<SysInParamPo> sysInParamPoList = resultMap.stream()
//                .map(map -> JSON.parseObject(JSON.toJSONString(map), SysInParamPo.class))
//                .collect(Collectors.toList());
//        ;
//        if (!ObjectUtils.isEmpty(sysInParamPoList) && sysInParamPoList.size() > 0) {
//            List<String> stringList = sysInParamPoList.stream().distinct()
//                    .map(SysInParamPo::getNote).collect(Collectors.toList());
////            List<SysInParamPo> sysInParamPoList1 = sysInParamService.list(Wrappers.<SysInParamPo>lambdaQuery()
////                    .in(SysInParamPo::getNote, stringList));
//            String sql1 = "SELECT *  FROM njssmx_sjgl.sys_result_tem where note in('" + stringList.toString().replace("[", "").replace("]", "") + "')";
////            //        //        System.out.println(sql);(sql1);
//            List<Map<String, Object>> resultMap1 = DBHelper.NpgNormal_GetListDic(sql1, pgUrl, pgUserName, pgPassword);
//            List<SysInParamPo> sysInParamPoList1 = resultMap1.stream()
//                    .map(map -> JSON.parseObject(JSON.toJSONString(map), SysInParamPo.class))
//                    .collect(Collectors.toList());
//            ;
//
//            return sysInParamPoList1.stream().map(SysInParamPo::getId).collect(Collectors.toList());
//        }
//
//        return null;
//    }
//
//    public Future<String> executeAsyncTask(List<SysInParamDto> list, InParamDto queryParm) {
//        return threadPoolTaskExecutor.submit(() -> {
//            List<TableResDto> dtoList = new ArrayList<>();
//            // 异步执行的任务
//            for (SysInParamDto info : list) {
//                if (info.getNote().contains("GY") ||
//                        info.getNote().contains("ZH") ||
//                        info.getNote().contains("BM")) {
//                    //List<CountNumDto> countNumDtoList = rangeMapper.selectTableByShapeTwo(info);
////                    String sql="select a.gldh,COUNT(*) AS total_num,SUM(CASE WHEN dsdxbs = 0 THEN 1 ELSE 0 END) AS one," +
////                            "SUM(CASE WHEN dsdxbs = 1 THEN 1 ELSE 0 END) AS two," +
////                            "SUM(CASE WHEN qybs = 0 THEN 1 ELSE 0 END) AS three," +
////                            "SUM(CASE WHEN qybs = 1 THEN 1 ELSE 0 END) AS four ," +
////                            "SUM ( CASE WHEN dsdxbs = 0 and ( qybs = 0 or qybs =2)  THEN 1 ELSE 0 END ) AS five ," +
////                            "SUM ( CASE WHEN dsdxbs = 0 and qybs = 1   THEN 1 ELSE 0 END ) AS six ," +
////                            "SUM ( CASE WHEN dsdxbs = 1 and ( qybs = 0 or qybs =2) THEN 1 ELSE 0 END ) AS seven," +
////                            "SUM ( CASE WHEN dsdxbs = 1 and qybs = 1 THEN 1 ELSE 0 END ) AS eight " +
////                            "from "+info.getKey()+" as a where 1=1 " +
////                            "and sde.st_intersects( shape,sde.st_buffer('"+info.getShape()+"',"+info.getBufferRange()+")) ";
//                    String sql = "select a.gldh,COUNT(*) AS total_num,SUM(CASE WHEN dsdxbs = 0 THEN 1 ELSE 0 END) AS one," +
//                            "SUM(CASE WHEN dsdxbs = 1 THEN 1 ELSE 0 END) AS two," +
//                            "SUM(CASE WHEN qybs = 0 THEN 1 ELSE 0 END) AS three," +
//                            "SUM(CASE WHEN qybs = 1 THEN 1 ELSE 0 END) AS four ," +
//                            "SUM ( CASE WHEN dsdxbs = 0 and ( qybs = 0 or qybs =2)  THEN 1 ELSE 0 END ) AS five ," +
//                            "SUM ( CASE WHEN dsdxbs = 0 and qybs = 1   THEN 1 ELSE 0 END ) AS six ," +
//                            "SUM ( CASE WHEN dsdxbs = 1 and ( qybs = 0 or qybs =2) THEN 1 ELSE 0 END ) AS seven," +
//                            "SUM ( CASE WHEN dsdxbs = 1 and qybs = 1 THEN 1 ELSE 0 END ) AS eight " +
//                            "from " + info.getKey() + " as a where 1=1 " +
//                            "and sde.st_intersects( shape,sde.st_buffer(sde.st_geometry('" + info.getShape() + "'," + srid + ")," + info.getBufferRange() + ")) ";
//                    if (info.getUpDown() != null && info.getUpDown().size() > 0) {
//                        String upDownWhere = "(";
//                        for (int i = 0; i < info.getUpDown().size(); i++) {
//                            if (i == info.getUpDown().size() - 1) {
//                                upDownWhere = upDownWhere + info.getUpDown().get(i) + ") ";
//                            } else {
//                                upDownWhere = upDownWhere + info.getUpDown().get(i) + ",";
//                            }
//                        }
//                        sql = sql + " and a.dsdxbs  in " + upDownWhere;
//                    }
//                    if (info.getIsPublic() != null && info.getIsPublic().size() > 0) {
//                        String pubWhere = "(";
//                        for (int i = 0; i < info.getIsPublic().size(); i++) {
//                            if (i == info.getIsPublic().size() - 1) {
//                                pubWhere = pubWhere + info.getIsPublic().get(i) + ") ";
//                            } else {
//                                pubWhere = pubWhere + info.getIsPublic().get(i) + ",";
//                            }
//                        }
//                        sql = sql + "  and a.qybs  in   " + pubWhere;
//                    }
//
//                    //任意字段的模糊查询功能
//                    if (!StringUtils.isEmpty(queryParm.getVagueQueryParam())) {
////                        //        //        System.out.println(sql);(info.getKey());
//                        String[] str = info.getKey().split("\\.");
//                        String schema = str[0];
//                        String tableName = str[1];
//                        //查询所有列
//                        String colSql = "select column_name from information_schema.columns\n" +
//                                "where table_schema='" + schema + "' and table_name='" + tableName + "' and column_name!='shape' ;";
//                        List<Map<String, Object>> colList = DBHelper.NpgNormal_GetListDic(colSql, pgUrl, pgUserName, pgPassword);
//                        String whereSql = " and (";
//                        //循环遍历
////                        //        //        System.out.println(sql);(colList);
//                        for (int i = 0; i < colList.size(); i++) {
//                            if (i == colList.size() - 1) {
//                                whereSql = whereSql + "   CAST(a." + colList.get(i).get("column_name").toString() + " AS TEXT) like concat('%','" + queryParm.getVagueQueryParam() + "','%') )";
//                            } else {
//                                whereSql = whereSql + "   CAST(a." + colList.get(i).get("column_name").toString() + " AS TEXT) like concat('%','" + queryParm.getVagueQueryParam() + "','%') or ";
//                            }
//
//                        }
////                        //        //        System.out.println(sql);(whereSql);
//                        sql = sql + whereSql;
//                    }
//                    //历史查询(基于管线时间属性,查询时间字段区间数据)
//                    if (!StringUtils.isEmpty(queryParm.getHistoryQueryDataTimeParam()) && !StringUtils.isEmpty(queryParm.getStartQueryParamValue()) && !StringUtils.isEmpty(queryParm.getEndQueryParamValue())) {
//                        sql = sql + " and a." + queryParm.getHistoryQueryDataTimeParam() + " between '" + queryParm.getStartQueryParamValue() + "' and '" + queryParm.getEndQueryParamValue() + "'";
//                    }
////                    //        //        System.out.println(sql);("timeSql: " + sql);
//                    //指定任意字段和值查询
//                    if (!StringUtils.isEmpty(queryParm.getHistoryQueryParam()) && !StringUtils.isEmpty(queryParm.getHistoryQueryParamValue())) {
//                        sql = sql + " and  CAST(a." + queryParm.getHistoryQueryParam() + " AS TEXT) like concat('%','" + queryParm.getHistoryQueryParamValue() + "','%')";
//                    }
//                    if (!StringUtils.isEmpty(info.getResult())) {
//                        sql = sql + info.getResult();
//                    }
//
//                    sql = sql + " group by a.gldh ";
//                    List<CountNumDto> countNumDtoList = DBHelper.NpgNormal_GetListDic(sql, pgUrl, pgUserName, pgPassword).stream()
//                            .map(map -> JSON.parseObject(JSON.toJSONString(map), CountNumDto.class))
//                            .collect(Collectors.toList());
//                    ;
//                    if (!ObjectUtils.isEmpty(countNumDtoList)) {
//                        countNumDtoList.forEach(count -> {
//                            TableResDto tableResDto = new TableResDto();
//                            tableResDto.setKey(count.getGxdm());
//                            tableResDto.setCountDto(count);
//                            dtoList.add(tableResDto);
//                        });
//                    }
//                } else {
////                    CountNumDto countNumDto = getSumLine(info);
////                    String sql="select COUNT(*) AS total_num," +
//////                            "SUM(CASE WHEN dsdxbs = 0 THEN 1 ELSE 0 END) AS one," +
//////                            "SUM(CASE WHEN dsdxbs = 1 THEN 1 ELSE 0 END) AS two," +
//////                            "SUM(CASE WHEN qybs = 0 THEN 1 ELSE 0 END) AS three," +
//////                            "SUM(CASE WHEN qybs = 1 THEN 1 ELSE 0 END) AS four ," +
//////                            "SUM ( CASE WHEN dsdxbs = 0 and ( qybs = 0 or qybs =2)  THEN 1 ELSE 0 END ) AS five ," +
//////                            "SUM ( CASE WHEN dsdxbs = 0 and qybs = 1   THEN 1 ELSE 0 END ) AS six ," +
//////                            "SUM ( CASE WHEN dsdxbs = 1 and ( qybs = 0 or qybs =2) THEN 1 ELSE 0 END ) AS seven," +
//////                            "SUM ( CASE WHEN dsdxbs = 1 and qybs = 1 THEN 1 ELSE 0 END ) AS eight " +
//////                            "from "+info.getKey()+" as a where 1=1 and " +
//////                            "sde.st_intersects(shape,sde.st_buffer('"+info.getShape()+"',"+info.getBufferRange()+"))";
//                    String sql = "select COUNT(*) AS total_num," +
//                            "SUM(CASE WHEN dsdxbs = 0 THEN 1 ELSE 0 END) AS one," +
//                            "SUM(CASE WHEN dsdxbs = 1 THEN 1 ELSE 0 END) AS two," +
//                            "SUM(CASE WHEN qybs = 0 THEN 1 ELSE 0 END) AS three," +
//                            "SUM(CASE WHEN qybs = 1 THEN 1 ELSE 0 END) AS four ," +
//                            "SUM ( CASE WHEN dsdxbs = 0 and ( qybs = 0 or qybs =2)  THEN 1 ELSE 0 END ) AS five ," +
//                            "SUM ( CASE WHEN dsdxbs = 0 and qybs = 1   THEN 1 ELSE 0 END ) AS six ," +
//                            "SUM ( CASE WHEN dsdxbs = 1 and ( qybs = 0 or qybs =2) THEN 1 ELSE 0 END ) AS seven," +
//                            "SUM ( CASE WHEN dsdxbs = 1 and qybs = 1 THEN 1 ELSE 0 END ) AS eight " +
//                            "from " + info.getKey() + " as a where 1=1 and " +
//                            "sde.st_intersects(shape,sde.st_buffer(sde.st_geometry('" + info.getShape() + "'," + srid + ")," + info.getBufferRange() + "))";
//                    if (info.getUpDown() != null && info.getUpDown().size() > 0) {
//                        String upDownWhere = "(";
//                        for (int i = 0; i < info.getUpDown().size(); i++) {
//                            if (i == info.getUpDown().size() - 1) {
//                                upDownWhere = upDownWhere + info.getUpDown().get(i) + ") ";
//                            } else {
//                                upDownWhere = upDownWhere + info.getUpDown().get(i) + ",";
//                            }
//                        }
//                        sql = sql + " and a.dsdxbs  in " + upDownWhere;
//                    }
//                    if (info.getIsPublic() != null && info.getIsPublic().size() > 0) {
//                        String pubWhere = "(";
//                        for (int i = 0; i < info.getIsPublic().size(); i++) {
//                            if (i == info.getIsPublic().size() - 1) {
//                                pubWhere = pubWhere + info.getIsPublic().get(i) + ") ";
//                            } else {
//                                pubWhere = pubWhere + info.getIsPublic().get(i) + ",";
//                            }
//                        }
//                        sql = sql + " and  a.qybs  in   " + pubWhere;
//                    }
//                    //任意字段的模糊查询功能
//                    if (!StringUtils.isEmpty(queryParm.getVagueQueryParam())) {
////                        //        //        System.out.println(sql);(info.getKey());
//                        String[] str = info.getKey().split("\\.");
//                        String schema = str[0];
//                        String tableName = str[1];
//                        //查询所有列
//                        String colSql = "select column_name from information_schema.columns\n" +
//                                "where table_schema='" + schema + "' and table_name='" + tableName + "' and column_name!='shape' ;";
//                        List<Map<String, Object>> colList = DBHelper.NpgNormal_GetListDic(colSql, pgUrl, pgUserName, pgPassword);
//                        String whereSql = " and (";
//                        //循环遍历
////                        //        //        System.out.println(sql);(colList);
//                        for (int i = 0; i < colList.size(); i++) {
//                            if (i == colList.size() - 1) {
//                                whereSql = whereSql + "   CAST(a." + colList.get(i).get("column_name").toString() + " AS TEXT) like concat('%','" + queryParm.getVagueQueryParam() + "','%') )";
//                            } else {
//                                whereSql = whereSql + "   CAST(a." + colList.get(i).get("column_name").toString() + " AS TEXT) like concat('%','" + queryParm.getVagueQueryParam() + "','%') or ";
//                            }
//
//                        }
////                        //        //        System.out.println(sql);(whereSql);
//                        sql = sql + whereSql;
//                    }
//                    //历史查询(基于管线时间属性,查询时间字段区间数据)
//                    if (!StringUtils.isEmpty(queryParm.getHistoryQueryDataTimeParam()) && !StringUtils.isEmpty(queryParm.getStartQueryParamValue()) && !StringUtils.isEmpty(queryParm.getEndQueryParamValue())) {
//                        sql = sql + " and (a." + queryParm.getHistoryQueryDataTimeParam() + " between '" + queryParm.getStartQueryParamValue() + "' and '" + queryParm.getEndQueryParamValue() + "') ";
//                    }
////                    //        //        System.out.println(sql);("timeSql: " + sql);
//                    if (!StringUtils.isEmpty(info.getResult())) {
////                        //        //        System.out.println(sql);(info.getResult());
//                        sql = sql + info.getResult();
//                    }
//                    //指定任意字段和值查询
//                    if (!StringUtils.isEmpty(queryParm.getHistoryQueryParam()) && !StringUtils.isEmpty(queryParm.getHistoryQueryParamValue())) {
//                        sql = sql + " and  CAST(a." + queryParm.getHistoryQueryParam() + " AS TEXT) like concat('%','" + queryParm.getHistoryQueryParamValue() + "','%')";
//                    }
////                    //        //        System.out.println(sql);("test-:" + sql);
//                    CountNumDto countNumDto = BeanUtil.mapToBean(DBHelper.NpgNormal_GetListDicNo1(sql, pgUrl, pgUserName, pgPassword), CountNumDto.class, true);
//                    ;
//                    if (!ObjectUtils.isEmpty(countNumDto)) {
//                        if (!StringUtils.isEmpty(info.getKey())) {
//                            TableResDto tableResDto = new TableResDto();
//                            tableResDto.setKey(info.getKey());
//                            tableResDto.setCountDto(countNumDto);
//                            dtoList.add(tableResDto);
//                        }
//                    }
//                }
//            }
//            return JSON.toJSONString(dtoList);
//        });
//    }
//
//    public Future<String> executeExcAnalyseTask(List<SysInParamPo> list) {
//        List<ResultByLineDto> dtoList = new ArrayList<>();
//
//        return threadPoolTaskExecutor.submit(() -> {
//            // 异步执行的任务
//            for (SysInParamPo info : list) {
//                //List<ResultByLineDto> result = rangeMapper.selectExcAnalyse(info);
//                String sql = "select A.*, a.xzq as ssqy,a.zydw as tcdw,sde.st_astext(a.shape) as shapeText from" + info.getKey() + " as a" + " where 1=1 " +
//                        "and sde.st_intersects( shape,sde.st_buffer('" + info.getShape() + "',1))";
//                if (!StringUtils.isEmpty(info.getResult())) {
//                    sql = sql + info.getResult();
//                }
//
//                List<ResultByLineDto> result = DBHelper.NpgNormal_GetListDic(sql, pgUrl, pgUserName, pgPassword).stream()
//                        .map(map -> JSON.parseObject(JSON.toJSONString(map), ResultByLineDto.class))
//                        .collect(Collectors.toList());
//                ;
//                if (!ObjectUtils.isEmpty(result) && result.size() > 0) {
//                    result.forEach(info1 -> {
//                        String[] strings = info.getKey().split("\\.");
//                        info1.setTypeName(strings[1]);
//                    });
//
//                    dtoList.addAll(result);
//                }
//            }
//            return JSON.toJSONString(dtoList);
//        });
//    }
//
//    //构造数据填充数据
//    private List<SysInParamPo> getData(List<SysInParamPo> list, List<TableResDto> resultRecipientList
//            , InParamDto inParamDto) {
//        //SysInParamPo info = list.get(0);
//        list.forEach(info1 -> {
//            if (!ObjectUtils.isEmpty(info1.getChildren()) && info1.getChildren().size() > 0) {
//                info1.getChildren().forEach(info2 -> {
//                    if (!ObjectUtils.isEmpty(info2.getChildren()) && info2.getChildren().size() > 0) {
//                        info2.getChildren().forEach(info3 -> {
//                            //getMinimumChildren(info3, info3.getChildren(), resultRecipientList);
//                            if (!ObjectUtils.isEmpty(info3.getChildren()) && info3.getChildren().size() > 0) {
//                                info3.getChildren().forEach(info4 -> {
//                                    if (!ObjectUtils.isEmpty(info4.getChildren()) && info4.getChildren().size() > 0) {
//                                        info4.getChildren().forEach(info5 -> {
//                                            resultRecipientList.forEach(res -> {
//                                                //计算数量
//                                                String note;
//                                                if (status) {
//                                                    //note = "njssmx_sjgl." + info5.getNote();
//                                                    note = "postgres." + info5.getNote();
//                                                } else {
//                                                    //note = "njssmx_sjgl." + info5.getNote();
//                                                    note = "postgres." + info5.getNote();
//                                                }
//                                                if (note.contains("GY") ||
//                                                        note.contains("ZH") ||
//                                                        note.contains("BM")) {
//                                                    if (!StringUtils.isEmpty(info5.getUrl())) {
//                                                        String gxdm = info5.getUrl();
//                                                        if (gxdm.equals(res.getKey())) {
//                                                            if (info2.getValue().equals("地上") && info3.getValue().equals("公共")) {
//                                                                info5.setCount(res.getCountDto().getSeven());
//                                                            }
//                                                            if (info2.getValue().equals("地上") && info3.getValue().equals("非公共")) {
//
//                                                                info5.setCount(res.getCountDto().getEight());
//                                                            }
//
//                                                            if (info2.getValue().equals("地下") && info3.getValue().equals("公共")) {
//                                                                info5.setCount(res.getCountDto().getFive());
//                                                            }
//                                                            if (info2.getValue().equals("地下") && info3.getValue().equals("非公共")) {
//                                                                info5.setCount(res.getCountDto().getSix());
//                                                            }
//                                                        }
//                                                    }
//                                                } else {
//                                                    if (note.equals(res.getKey())) {
//                                                        if (info2.getValue().equals("地上") && info3.getValue().equals("公共")) {
//                                                            info5.setCount(res.getCountDto().getSeven());
//                                                        }
//                                                        if (info2.getValue().equals("地上") && info3.getValue().equals("非公共")) {
//
//                                                            info5.setCount(res.getCountDto().getEight());
//                                                        }
//
//                                                        if (info2.getValue().equals("地下") && info3.getValue().equals("公共")) {
//                                                            info5.setCount(res.getCountDto().getFive());
//                                                        }
//                                                        if (info2.getValue().equals("地下") && info3.getValue().equals("非公共")) {
//                                                            info5.setCount(res.getCountDto().getSix());
//                                                        }
//                                                    }
//                                                }
//                                            });
//                                        });
//                                    }
//                                });
//                            }
//                        });
//                    }
//                });
//            }
//        });
//        return getCount(list);
//    }
//
//    private List<SysInParamPo> getCount(List<SysInParamPo> list) {
//        list.forEach(info -> {
//            if (!ObjectUtils.isEmpty(info.getChildren()) && info.getChildren().size() > 0) {
//                info.getChildren().forEach(info1 -> {
//                    if (!ObjectUtils.isEmpty(info1.getChildren()) && info1.getChildren().size() > 0) {
//                        info1.getChildren().forEach(info2 -> {
//                            if (!ObjectUtils.isEmpty(info2.getChildren()) && info2.getChildren().size() > 0) {
//                                info2.getChildren().forEach(info3 -> {
//                                    int num = info3.getChildren().stream().mapToInt(SysInParamPo::getCount).sum();
//                                    info3.setCount(num);
//                                });
//                            }
//                            int num = info2.getChildren().stream().mapToInt(SysInParamPo::getCount).sum();
//                            info2.setCount(num);
//                        });
//                    }
//                    int num = info1.getChildren().stream().mapToInt(SysInParamPo::getCount).sum();
//                    info1.setCount(num);
//                });
//            }
//        });
//        return list;
//    }
//
//
//    private List<String> FindPath(String strNodeId1, String strNodeId2, String strGXLyrID, NodeInfo nodeInfo) {
//        Map<String, Object> hashTblNetWork = new Hashtable<>();
//        List<String> strObjectIdDepth1ArrList = new ArrayList<>();
//        String strEndObjID = BuildNetWork(strNodeId1, strNodeId2, strGXLyrID, hashTblNetWork, strObjectIdDepth1ArrList, nodeInfo);
//        if (strEndObjID == null) {
//            strObjectIdDepth1ArrList.clear();
//            return strObjectIdDepth1ArrList;
//        } else {
//            //搜索到连通的管线段
//            return GetConnectedGX(hashTblNetWork, strObjectIdDepth1ArrList, strEndObjID);
//        }
//    }
//
//    private String BuildNetWork(
//            String strNodeId1, String strNodeId2,
//            String strGxLyrTableName, Map<String, Object> hashTblNetWork,
//            List<String> strObjectIdDepth1ArrList, NodeInfo nodeInfo
//    ) {
//        try {
//            //根据NodeId搜索关联的所有管线段
//            List<String> strNodeIdInitArrList = new ArrayList<>(); //记录初始需搜索的NODEID
//            List<String> strObjectIdInitArrList = new ArrayList<>(); //记录初始搜索时NODEID对应管线OBJECTID,第一次为空
//            List<String> strNodeIdResaultArrList = new ArrayList<>(); //记录下一轮搜索的NODEID
//            List<String> strObjectIdResaultArrList = new ArrayList<>(); //记录下一轮搜索的NODEID对应管线OBJECTID
//            strNodeIdInitArrList.add(strNodeId1);
//            while (!strNodeIdInitArrList.isEmpty()) {
//                for (int i = 0; i < strNodeIdInitArrList.size(); i++) {
//                    String strNodeIdtmp = strNodeIdInitArrList.get(i);
//                    List<String> strNodeIdOtherArrList = new ArrayList<>();
//                    List<String> strObjIDArrList = new ArrayList<>();
//                    if (!SearchAssociateGXByNodeID(strGxLyrTableName, strNodeIdtmp, strNodeIdOtherArrList, strObjIDArrList, nodeInfo)) {
//                        continue;
//                    }
//                    if (strNodeIdInitArrList.size() != strObjectIdInitArrList.size()) {
//                        //记录第一搜索深度的objectid
//                        strObjectIdDepth1ArrList.addAll(strObjIDArrList);
//                    }
//                    //strObjIDArrList中的每个ObjID是否在有向网络表中已经存在
//                    for (int j = 0; j < strObjIDArrList.size(); j++) {
//                        String strNodeId2tmp = strNodeIdOtherArrList.get(j);
//                        String strObjId = strObjIDArrList.get(j);
//                        if (!hashTblNetWork.containsKey(strObjId) && !strObjectIdInitArrList.contains(strObjId)) {
//                            if (strNodeIdInitArrList.size() == strObjectIdInitArrList.size()) {
//                                hashTblNetWork.put(strObjId, strObjectIdInitArrList.get(i));
//                            }
//                            strNodeIdResaultArrList.add(strNodeIdOtherArrList.get(j));
//                            strObjectIdResaultArrList.add(strObjId);
//                        }
//                        if (strNodeId2.equals(strNodeId2tmp)) {
//                            return strObjId;
//                            //搜索到第二点，连通
//                        }
//                    }
//                }
//                strNodeIdInitArrList.clear();
//                strNodeIdInitArrList.addAll(strNodeIdResaultArrList);
//                strNodeIdResaultArrList.clear();
//                strObjectIdInitArrList.clear();
//                strObjectIdInitArrList.addAll(strObjectIdResaultArrList);
//                strObjectIdResaultArrList.clear();
//            }
//        } catch (RuntimeException ex) {
//            ex.printStackTrace();
//            return null;
//        }
//        return null;
//    }
//
//    private boolean SearchAssociateGXByNodeID(String gxtableName, String strNodeId, List<String> strNodeIdOtherArrList, List<String> strObjIDArrList, NodeInfo nodeInfo) {
//        String fields = nodeInfo.getFlowName() + ", " + nodeInfo.getObjectid() + ", " + nodeInfo.getStartNub() + ", " + nodeInfo.getEndNub();
//        //String mode = "njssmx_sjgl.";
//        String mode = "postgres.";
//        String params = ",xzq as ssqy,zydw as tcdw ";
//        String sql = String.format(" SELECT " + fields + params + " FROM " + mode + "%1$s where %4$s='%2$s' or %5$s='%3$s'", gxtableName, strNodeId, strNodeId, nodeInfo.getStartNub(), nodeInfo.getEndNub());
//        //log.info("SearchAssociateGXByNodeID:执行：" + sql);
////        //        //        System.out.println(sql);(sql);
////        List<Map<String, Object>> feature = pgService.commandsqltoLX(sql);
//        List<Map<String, Object>> feature = DBHelper.NpgNormal_GetListDic(sql, pgUrl, pgUserName, pgPassword);
//        if (feature.size() == 0) {
//            return false;
//        }
//
//        for (Map<String, Object> stringObjectMap : feature) {
//            String strSNODIDValue = stringObjectMap.get(nodeInfo.getStartNub()).toString();
//            String strENODIDValue = stringObjectMap.get(nodeInfo.getEndNub()).toString();
//            //合理的管线SNODID、ENODID肯定不相同
//            if (strNodeId.equals(strSNODIDValue)) {
//                strNodeIdOtherArrList.add(strENODIDValue);
//            } else {
//                strNodeIdOtherArrList.add(strSNODIDValue);
//            }
//            //string strOBJCTIDValue = feature.get_Value(feature.Fields.FindField("OBJECTID")).ToString();
//            //返回OBJECTID改成FEATURECODE
//            String strOBJCTIDValue = stringObjectMap.get(nodeInfo.getObjectid()).toString();
//            strObjIDArrList.add(strOBJCTIDValue);
//        }
//
//        if (!strNodeIdOtherArrList.isEmpty()) {
//            if (strNodeIdOtherArrList.size() == strObjIDArrList.size()) {
//                return true;
//            } else {
//                //合理管线不会发生
//                strNodeIdOtherArrList.clear();
//                strObjIDArrList.clear();
//                return false;
//            }
//        } else {
//            return false;
//        }
//    }
//
//    private List<String> GetConnectedGX(Map<String, Object> hashTblNetWork, List<String> strObjectIdDepth1ArrList, String strEndObjID) {
//        ArrayList<String> strObjIDArrList = new ArrayList<>();
//        //从最后一条向前搜索
//        String strStartObjID = strEndObjID;
//        if (!StringUtils.isEmpty(strEndObjID)) {
//            strObjIDArrList.add(strEndObjID);
//        }
//        while (!strObjectIdDepth1ArrList.contains(strStartObjID)) {
//            if (!hashTblNetWork.isEmpty()) {
//                strObjIDArrList.add(hashTblNetWork.get(strStartObjID).toString());
//                strStartObjID = hashTblNetWork.get(strStartObjID).toString();
//            } else {
//                break;
//            }
//        }
//        return strObjIDArrList;
//    }
//
//    public final List<Map<String, Object>> selectMap(String sql, NodeInfo nodeInfo) {
//        List<Map<String, Object>> datas = new ArrayList<>();
//        Connection conn = null;
//        Connection gisConn = null;
//        try {
//            datas = commandsqltoLX(sql, nodeInfo);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//        } finally {
//            if (conn != null) {
//                try {
//                    conn.close();
//                } catch (SQLException e) {
//                    e.printStackTrace();
//                }
//            }
//            if (gisConn != null) {
//                try {
//                    gisConn.close();
//                } catch (SQLException e) {
//                    e.printStackTrace();
//                }
//            }
//        }
//        return datas;
//    }
//
//    public final List<Map<String, Object>> commandsqltoLX(String sql, NodeInfo nodeInfo) {
//        List<Map<String, Object>> datas = new ArrayList<>();
//        try {
//            //log.info("commandsqltoLX:" + sql);
//            //        //        System.out.println(sql);(sql);
//            String getLineTable = nodeInfo.getLineTable().get(0); // 获取第一个表
//            datas = DBHelper.NpgNormal_GetListDic(sql, pgUrl, pgUserName, pgPassword);
//            for (Map<String, Object> map : datas) {
//                if (map.get("shape") != null) {
//                    String shape = map.get("shape").toString();
//                    //        //        System.out.println(sql);(shape + ":" + map.get("objectid"));
//                    String shapeSql = "SELECT sde.st_astext(shape) as shape from postgres." + getLineTable + " where objectid in(" + map.get("objectid") + ")";
//                    //map.put("asText", getAsText(shape));
//                    //        //        System.out.println(sql);(shapeSql);
//                    map.put("shapetext", DBHelper.NpgNormal_GetScalar(shapeSql, pgUrl, pgUserName, pgPassword).toString());
//                }
//            }
//            return datas;
//        } catch (Exception ex) {
//            //log.error("commandsqltoDir:" + sql + "@" + ex.getMessage());
//            ex.printStackTrace();
//        }
//        return null;
//    }
//
//    public String getAsText(String shape) throws Exception {
//        String sql = "SELECT st_astext(" + shape + ") as shape";
////        return pgSqlMapper.getOneSelect(sql);
//        //        //        System.out.println(sql);(sql);
//        return DBHelper.NpgNormal_GetScalar(sql, pgUrl, pgUserName, pgPassword).toString();
//    }
//
//    //C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
//    ///#region 流向分析或溯源分析
//    public final ArrayList<String> LYFX(NodeInfo nodeInfo, String StrError) {
//        ArrayList<String> lstresult = new ArrayList<>();
//        try {
//            DT(nodeInfo.getStrNodeId(), lstresult, StrError, nodeInfo);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//        }
//        return lstresult;
//    }
//
//    public final void DT(String strNodeId, List<String> lstresult, String StrError, NodeInfo nodeInfo) {
//        String[] strNodeIds = null;
//        if (strNodeId.contains(",")) {
//            String[] strNodeIdes = strNodeId.split(",");
//            strNodeIds = new String[strNodeIdes.length - 1];
//            System.arraycopy(strNodeIdes, 1, strNodeIds, 0, strNodeIds.length);
//            strNodeId = strNodeIdes[0];
//        }
//        List<List<String>> lsttmp = GetFather(strNodeId, StrError, nodeInfo);
//        boolean IsStop = false;
//        if (lsttmp != null) {
//            if (strNodeIds != null) {
//                lsttmp.get(0).addAll(Arrays.asList(strNodeIds));
//            }
//            for (int m = 0; m < lsttmp.get(1).size(); m++) {
//                if (!lstresult.contains(lsttmp.get(1).get(m).toString())) {
//                    lstresult.add(lsttmp.get(1).get(m).toString());
//                } else {
//                    IsStop = true;
//                }
//            }
//            if (!IsStop) {
//                for (int i = 0; i < lsttmp.get(0).size(); i++) {
//                    DT(lsttmp.get(0).get(i).toString(), lstresult, StrError, nodeInfo);
//                }
//            }
//        }
//    }
//
//    public final List<List<String>> GetFather(String nodeId, String strError, NodeInfo nodeInfo) {
////        String mode = "njssmx_sjgl.";
//        String mode = "postgres.";
//        String params = " ,xzq as ssqy,zydw as tcdw ";
//        String sql = String.format(" select %1$s " + params + " from " + mode + "%2$s where ((%3$s='%4$s' and %5$s = '1') or (%6$s='%4$s' and %5$s = '0') )  ",
//                String.join(",", nodeInfo.getStartNub(), nodeInfo.getEndNub(), nodeInfo.getObjectid()),
//                nodeInfo.getLineTable(), nodeInfo.getStartNub(), nodeId, nodeInfo.getFlowName(), nodeInfo.getEndNub()); //溯源分析
//        if (nodeInfo.getStatus().equals("0")) {
//            sql = String.format(" select %1$s " + params + " from " + mode + "%2$s where ((%6$s='%4$s' and %5$s = '1') or (%3$s='%4$s' and %5$s = '0'))  ",
//                    String.join(",", nodeInfo.getStartNub(), nodeInfo.getEndNub(), nodeInfo.getObjectid()), nodeInfo.getLineTable(), nodeInfo.getStartNub(), nodeId, nodeInfo.getFlowName(), nodeInfo.getEndNub()); //流向分析
//        }
//        //        //        System.out.println(sql);(sql);
//        List<Map<String, Object>> feature = DBHelper.NpgNormal_GetListDic(sql, pgUrl, pgUserName, pgPassword);
//        List<String> strNodeIdOtherArrList = new ArrayList<>();
//        List<String> strObjIDArrList = new ArrayList<>();
//        if (!GetLineID(feature, nodeId, strNodeIdOtherArrList, strObjIDArrList, nodeInfo)) {
//            return null;
//        }
//        return new ArrayList<>(Arrays.asList(strNodeIdOtherArrList, strObjIDArrList));
//    }
//
//    public final boolean GetLineID(List<Map<String, Object>> feature, String strNodeId, List<String> strNodeIdOtherArrList, List<String> strObjIDArrList, NodeInfo nodeInfo) {
//        for (int i = 0; i < feature.size(); i++) {
//            String strSNODIDValue = feature.get(i).get(nodeInfo.getStartNub()).toString();
//            String strENODIDValue = feature.get(i).get(nodeInfo.getEndNub()).toString();
//            if (strNodeId.equals(strSNODIDValue)) {
//                strNodeIdOtherArrList.add(strENODIDValue);
//            } else {
//                strNodeIdOtherArrList.add(strSNODIDValue);
//            }
//            String strOBJCTIDValue = feature.get(i).get(nodeInfo.getObjectid()).toString();
//            strObjIDArrList.add(strOBJCTIDValue);
//        }
//
//        if (!strNodeIdOtherArrList.isEmpty()) {
//            if (strNodeIdOtherArrList.size() == strObjIDArrList.size()) {
//                return true;
//            }
//            strNodeIdOtherArrList.clear();
//            strObjIDArrList.clear();
//            return false;
//        }
//        return false;
//    }
//
//
//    @Override
//    public List<CrossSectionAnalysisVo> queryCrossSectionAnalysis(MultiTypeReqDto req) throws Exception {
//        if (req.getGeoCompareModels().size() > 0) {
//            for (GeoCompareModel geo : req.getGeoCompareModels()) {
//                if (StringUtils.isNotEmpty(geo.getGeoValueFilter().getGeoValue())) {
//                    geo.getGeoValueFilter().setGeoValue(getCoordinate4549(geo.getGeoValueFilter().getGeoValue()));
//                }
//            }
//        }
//        String filterSQL = req.generateSqlFilter();
//        if (!org.springframework.util.StringUtils.isEmpty(req.getResult())) {
//            String res = AesUtil.decrypt(req.getResult());
//            filterSQL = filterSQL + res;
//        }
//
//        if (StringUtils.isEmpty(filterSQL)) {
//            throw new CustomException("invalid params");
//        }
//        List<String> typeNames = req.getTypeNames();
//        List<CrossSectionAnalysisVo> sectionAnalysisVoList = new ArrayList<>();
//        String sql = filterSQL;
//        //        //        System.out.println(sql);("filterSql:" + filterSQL);
//        typeNames.parallelStream().forEach(name -> {
//            //List<CrossSectionAnalysisVo> list = baseMapper.queryCrossSectionAnalysis(name, sql);
////            String sqlStr="select a.*, '"+name+"' as typeName, public.st_astext(shape) as coordinate,public.st_astext(public.ST_Centroid(shape)) as point\n" +
////                    "        from "+name+" as a\n" +
////                    "        where "+sql+" order by objectid";
//            String sqlStr = "select a.*, '" + name + "' as typeName, sde.st_astext(shape) as coordinate,sde.st_astext(sde.ST_Centroid(shape)) as point\n" +
//                    "        from " + name + " as a\n" +
//                    "        where " + sql + " order by a.objectid";
//            sqlStr = sqlStr.replace("public", "sde").replace("st_geomfromtext", "st_geometry");
//            //        //        System.out.println(sql);(sqlStr);
//            List<CrossSectionAnalysisVo> list = DBHelper.NpgNormal_GetListDic(sqlStr, pgUrl, pgUserName, pgPassword).stream()
//                    .map(map -> JSON.parseObject(JSON.toJSONString(map), CrossSectionAnalysisVo.class))
//                    .collect(Collectors.toList());
//            sectionAnalysisVoList.addAll(list);
//        });
//        GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null);
//        WKTReader reader = new WKTReader(geometryFactory);
//        //        //        System.out.println(sql);("req:" + req.getGeoCompareModels());
//        String spatialDtoWKT = req.getGeoCompareModels().get(0).getGeoValueFilter().getGeoValue();
//        //        //        System.out.println(sql);(spatialDtoWKT);
//        for (CrossSectionAnalysisVo crossSectionAnalysisVo : sectionAnalysisVoList) {
//            Geometry gx1Geom = reader.read(spatialDtoWKT);
//            LineString line1 = null;
//            if (gx1Geom instanceof MultiLineString) {
//                MultiLineString var2 = (MultiLineString) gx1Geom;
//                line1 = (LineString) var2.getGeometryN(0);
//            } else if (gx1Geom instanceof LineString) {
//                line1 = (LineString) gx1Geom;
//            }
//            Geometry gx2Geom = reader.read(crossSectionAnalysisVo.getWkt());
//            LineString line2 = null;
//            if (gx2Geom instanceof MultiLineString) {
//                MultiLineString var2 = (MultiLineString) gx2Geom;
//                line2 = (LineString) var2.getGeometryN(0);
//            } else if (gx2Geom instanceof LineString) {
//                line2 = (LineString) gx2Geom;
//            }
//            this.calIntersectionData(spatialDtoWKT, crossSectionAnalysisVo);
//            calculationVerticalDistance(line1, line2, crossSectionAnalysisVo);
//            //坐标转换
////            if(StringUtils.isNotEmpty(crossSectionAnalysisVo.getIntersectionPoint())){
////                crossSectionAnalysisVo.setIntersectionPoint(getCoordinateJWD(crossSectionAnalysisVo.getIntersectionPoint()));
////            }
////            if(StringUtils.isNotEmpty(crossSectionAnalysisVo.getCoordinate())){
////                crossSectionAnalysisVo.setCoordinate(getCoordinateJWD(crossSectionAnalysisVo.getCoordinate()));
////            }
////            if(StringUtils.isNotEmpty(crossSectionAnalysisVo.getPoint())){
////                crossSectionAnalysisVo.setPoint(getCoordinateJWD(crossSectionAnalysisVo.getPoint()));
////            }
//
//        }
//        return sectionAnalysisVoList;
//    }
//
//    @Override
//        public SectionAnalysisVo querySectionAnalysis(SectionAnalysisDto sectionAnalysisDto) {
//            sectionAnalysisDto.setCoordinate("'SRID=" + sectionAnalysisDto.getCoordinate() + ";'");
//            String res;
//            if (!StringUtils.isEmpty(sectionAnalysisDto.getResult())) {
//                res = AesUtil.decrypt(sectionAnalysisDto.getResult());
//                sectionAnalysisDto.setResult(res);
//            }
//            String sql = "select\n" +
//                    "            typename.bsm as bh,typename.*,\n" +
//                    "            sde.st_length(typename.shape) as \"horizontalgdcd\",\n" +
//                    "            replace('" + sectionAnalysisDto.getTypeName() + "','line','point') as \"typeName\",\n" +
//                    "            round(sde.st_x(sde.st_startpoint(typename.shape))::numeric,8) as \"start_point_x\",\n" +
//                    "            round(sde.st_y(sde.st_startpoint(typename.shape))::numeric,8) as \"start_point_y\",\n" +
//                    "            round(sde.st_x(sde.st_endpoint(typename.shape))::numeric,8) as \"end_point_x\",\n" +
//                    "            round(sde.st_y(sde.st_endpoint(typename.shape))::numeric,8) as \"end_point_y\",\n" +
//                    "            sde.st_astext(typename.shape) as coordinate,\n" +
//                    "            sde.st_astext(sde.ST_Centroid(typename.shape)) as point,\n" +
//                    "            sde.st_astext(sde.st_envelope(sde.st_buffer(typename.shape, 0.01))) as \"shape_buf\"\n" +
//                    "            from " + sectionAnalysisDto.getTypeName() + " as typename";
//            sql = sql + " where typename.bsm='" + sectionAnalysisDto.getFeaturecode() + "'";
//            SectionLine sectionAnalysisPipe = BeanUtil.mapToBean(DBHelper.NpgNormal_GetListDicNo1(sql, pgUrl, pgUserName, pgPassword), SectionLine.class, true);
//            if (null == sectionAnalysisPipe) {
//                throw new CustomException("invalid objectid");
//            }
//            List<Integer> gxIds = new ArrayList<>();
//            gxIds.add(sectionAnalysisPipe.getObjectid());
//            //坐标系srid
//            String coordinate = sectionAnalysisDto.getCoordinate();
//            sectionAnalysisDto.setCoordinate(coordinate);
//            sectionAnalysisPipe.setCoor(sectionAnalysisDto.getCoordinate());
//            if (sectionAnalysisDto.getPointId() != null) {
//                sectionAnalysisPipe.setPointid(sectionAnalysisDto.getPointId());
//            }
//            List<Integer> gdIds = new ArrayList<>();
//            //查询与该线相连接的其他管线
//            String sectionPointsSql = " select * from\n" +
//                    "        (\n" +
//                    "        select\n" +
//                    "        objectid,\n" +
//                    "        " + sectionAnalysisPipe.getObjectid() + " as lineid,\n" +
//                    "        bsm as bh,\n" +
//                    "        dmgc,\n" +
//                    "        replace('" + sectionAnalysisPipe.getTypeName() + "','point','line') as typeName,\n" +
//                    "        round(sde.st_x(shape)::numeric,8) as \"point_x\",\n" +
//                    "        round(sde.st_y(shape)::numeric,8) as \"point_y\",\n" +
//                    "        sde.st_astext(shape) as \"coordinate\",\n" +
//                    "        sde.st_astext(sde.st_envelope(sde.st_buffer(shape, 0.01))) as \"shape_buf\"\n" +
//                    "        from " + sectionAnalysisPipe.getTypeName() + "\n" +
//                    "        where\n" +
//                    "        sde.st_intersects(sde.st_geometry('" + sectionAnalysisPipe.getShapeBuf() + "'," + srid + "),shape)\n";
//            if (!String.valueOf(sectionAnalysisPipe.getPointid()).equals("") && !String.valueOf(sectionAnalysisPipe.getPointid()).equals("null")) {
//                sectionPointsSql = sectionPointsSql + " and  objectid !=" + sectionAnalysisPipe.getPointid();
//            }
//            sectionPointsSql = sectionPointsSql + ")t1 " + "where ((point_x=" + sectionAnalysisPipe.getStartPointX() + " and point_y=" + sectionAnalysisPipe.getStartPointY() + ") " +
//                    "or (point_x=" + sectionAnalysisPipe.getEndPointX() + " and point_y=" + sectionAnalysisPipe.getEndPointY() + "))";
//            if (gdIds.size() > 0) {
//                sectionPointsSql = sectionPointsSql + " and objectid not in(";
//                for (int i = 0; i < gdIds.size(); i++) {
//                    if (i == gdIds.size() - 1) {
//                        sectionPointsSql = sectionPointsSql + gdIds.get(i) + ")";
//                    } else {
//                        sectionPointsSql = sectionPointsSql + gdIds.get(i) + ",";
//                    }
//                }
//            }
//            List<SectionPoint> sectionPoints = DBHelper.NpgNormal_GetListDic(sectionPointsSql, pgUrl, pgUserName, pgPassword).stream()
//                    .map(map -> JSON.parseObject(JSON.toJSONString(map), SectionPoint.class))
//                    .collect(Collectors.toList());
//            gdIds.addAll(sectionPoints.parallelStream().map(SectionPoint::getObjectid).collect(Collectors.toList()));
//            if (sectionAnalysisPipe.getZdgc() != null && sectionAnalysisPipe.getQdgc() != null) {
//                //计算高程差
//                BigDecimal gc = sectionAnalysisPipe.getZdgc().subtract(sectionAnalysisPipe.getQdgc()).abs();
//                //管道水平长度
//                BigDecimal horizontalgdcd = sectionAnalysisPipe.getHorizontalgdcd();
//                double sqrt = Math.sqrt(Math.pow((gc).doubleValue(), INT) + Math.pow(horizontalgdcd.doubleValue(), INT));
//                sectionAnalysisPipe.setRealgdcd(BigDecimal.valueOf(sqrt));
//                BigDecimal k = gc.divide(horizontalgdcd, RoundingMode.CEILING);
//                double p = Math.atan(k.doubleValue()) * INT1 / Math.PI;
//                sectionAnalysisPipe.setGradient(BigDecimal.valueOf(p));
//            }
//            List<SectionLine> sectionLineList = new ArrayList<>();
//            sectionLineList.add(sectionAnalysisPipe);
//            List<SectionPoint> resultPointList = new ArrayList<>();
//            SectionAnalysisVo result = getResult(sectionPoints, sectionLineList, resultPointList, sectionAnalysisDto, gxIds, gdIds, 1, sectionAnalysisDto.getSectionNum());
//            return result;
//        }
//
//
//        /**
//         * 递归查询
//         *
//         * @param sectionPoints       与源管线相接的其他管线
//         * @param sectionAnalysisList 源管线
//         * @param resultPointList     返回集合
//         * @param i                   计数
//         * @param index               断面分析数量
//         * @param sectionAnalysisDto  入参
//         * @return
//         */
//        public SectionAnalysisVo getResult(List<SectionPoint> sectionPoints,
//                                           List<SectionLine> sectionAnalysisList,
//                                           List<SectionPoint> resultPointList,
//                                           SectionAnalysisDto sectionAnalysisDto,
//                                           List<Integer> gxIds,
//                                           List<Integer> gdIds, int i, int index) {
//            SectionAnalysisVo sectionAnalysisVo = new SectionAnalysisVo();
//            String coordinate = sectionAnalysisDto.getCoordinate();
//            //遍历与源管线相接的其他管线
//            for (SectionPoint sectionPoint : sectionPoints) {
//                sectionPoint.setCurrentIndex(i);
//                if (sectionPoint.getCurrentIndex() >= index) {
//                    sectionPoint.setEndFlag(1);
//                    resultPointList.add(sectionPoint);
//                } else {
//                    sectionPoint.setCoor(coordinate);
//                    sectionPoint.setCoorNum(sectionAnalysisDto.getCoordinate());
//                    //查询与当前管线相连接的其他管线
//                    String sectionLineListSql = "select * from\n" +
//                            "        (\n" +
//                            "        select\n" +
//                            "        typename.bsm as bh,typename.*,\n" +
//                            "        sde.st_length(typename.shape) as \"horizontalgdcd\",\n" +
//                            "        " + sectionPoint.getObjectid() + " as pointid,\n" +
//                            "        replace('" + sectionPoint.getTypeName() + "','line','point') as typeName,\n" +
//                            "        round(sde.st_x(sde.st_startpoint(typename.shape))::numeric,8) as \"start_point_x\",\n" +
//                            "        round(sde.st_y(sde.st_startpoint(typename.shape))::numeric,8) as \"start_point_y\",\n" +
//                            "        round(sde.st_x(sde.st_endpoint(typename.shape))::numeric,8) as \"end_point_x\",\n" +
//                            "        round(sde.st_y(sde.st_endpoint(typename.shape))::numeric,8) as \"end_point_y\",\n" +
//                            "        sde.st_astext(typename.shape) as \"coordinate\",\n" +
//                            "        sde.st_astext(sde.ST_Centroid(typename.shape)) as point,\n" +
//                            "        sde.st_astext(sde.st_envelope(sde.st_buffer(typename.shape, 0.01))) as \"shape_buf\"\n" +
//                            "        from " + sectionPoint.getTypeName() + " as typename\n" +
//                            "        where\n" +
//                            "        sde.st_intersects(sde.st_geometry('" + sectionPoint.getShapeBuf() + "'," + srid + "),typename.shape)\n" +
//                            "        and\n" +
//                            "        typename.objectid !=" + sectionPoint.getLineid() + "\n" +
//                            "        ) t1\n" +
//                            "        where\n" +
//                            "        ((start_point_x=" + sectionPoint.getPointX() + " and start_point_y=" + sectionPoint.getPointY() + ")\n" +
//                            "        or\n" +
//                            "        (end_point_x=" + sectionPoint.getPointX() + " and end_point_y=" + sectionPoint.getPointY() + "))";
//                    if (gxIds.size() > 0) {
//                        sectionLineListSql = sectionLineListSql + " and objectid not in(";
//                        for (int j = 0; j < gxIds.size(); j++) {
//                            if (j == gxIds.size() - 1) {
//                                sectionLineListSql = sectionLineListSql + gxIds.get(j) + ")";
//                            } else {
//                                sectionLineListSql = sectionLineListSql + gxIds.get(j) + ",";
//                            }
//                        }
//                    }
//
//                    List<SectionLine> sectionLineList = DBHelper.NpgNormal_GetListDic(sectionLineListSql, pgUrl, pgUserName, pgPassword).stream()
//                            .map(map -> JSON.parseObject(JSON.toJSONString(map), SectionLine.class))
//                            .collect(Collectors.toList());
//                    if (!CollectionUtils.isEmpty(sectionAnalysisList)) {
//                        gxIds.addAll(sectionLineList.parallelStream().map(SectionLine::getObjectid).collect(Collectors.toList()));
//                    }
//                    if (sectionLineList == null || sectionLineList.isEmpty()) {
//                        sectionPoint.setEndFlag(1);
//                    }
//                    i++;
//                    resultPointList.add(sectionPoint);
//                    if (!CollectionUtils.isEmpty(sectionLineList)) {
//                        for (SectionLine sectionLine : sectionLineList) {
//                            if (sectionLine.getQdgc() != null && sectionLine.getZdgc() != null) {
//                                BigDecimal gc = sectionLine.getZdgc().subtract(sectionLine.getQdgc()).abs();
//                                BigDecimal horizontalgdcd = sectionLine.getHorizontalgdcd();
//                                double sqrt = Math.sqrt(Math.pow((gc).doubleValue(), INT) + Math.pow(horizontalgdcd.doubleValue(), INT));
//                                sectionLine.setRealgdcd(BigDecimal.valueOf(sqrt));
//                                BigDecimal k = gc.divide(horizontalgdcd, RoundingMode.CEILING);
//                                double p = Math.atan(k.doubleValue()) * INT1 / Math.PI;
//                                sectionLine.setGradient(BigDecimal.valueOf(p));
//                            }
//                            sectionLine.setCoor(sectionAnalysisDto.getCoordinate());
//                            sectionAnalysisList.add(sectionLine);
//                            String sectionPointsSql = " select * from\n" +
//                                    "        (\n" +
//                                    "        select\n" +
//                                    "        objectid,\n" +
//                                    "        " + sectionLine.getObjectid() + " as lineid,\n" +
//                                    "        bsm as bh,\n" +
//                                    "        dmgc,\n" +
//                                    "        replace('" + sectionLine.getTypeName() + "','point','line') as typeName,\n" +
//                                    "        round(sde.st_x(shape)::numeric,8) as \"point_x\",\n" +
//                                    "        round(sde.st_y(shape)::numeric,8) as \"point_y\",\n" +
//                                    "        sde.st_astext(shape) as \"coordinate\",\n" +
//                                    "        sde.st_astext(sde.st_envelope(sde.st_buffer(shape, 0.01))) as \"shape_buf\"\n" +
//                                    "        from " + sectionLine.getTypeName() + "\n" +
//                                    "        where\n" +
//                                    "        sde.st_intersects(sde.st_geometry('" + sectionLine.getShapeBuf() + "'," + srid + "),shape)\n";
//                            if (!String.valueOf(sectionLine.getPointid()).equals("") && !String.valueOf(sectionLine.getPointid()).equals("null")) {
//                                sectionPointsSql = sectionPointsSql + " and  objectid !=" + sectionLine.getPointid();
//                            }
//                            sectionPointsSql = sectionPointsSql + ")t1 " + "where ((point_x=" + sectionLine.getStartPointX() + " and point_y=" + sectionLine.getStartPointY() + ") " +
//                                    "or (point_x=" + sectionLine.getEndPointX() + " and point_y=" + sectionLine.getEndPointY() + "))";
//                            if (gdIds.size() > 0) {
//                                sectionPointsSql = sectionPointsSql + " and objectid not in(";
//                                for (int j = 0; j < gdIds.size(); j++) {
//                                    if (j == gdIds.size() - 1) {
//                                        sectionPointsSql = sectionPointsSql + gdIds.get(j) + ")";
//                                    } else {
//                                        sectionPointsSql = sectionPointsSql + gdIds.get(j) + ",";
//                                    }
//                                }
//                            }
//                            List<SectionPoint> pointList = DBHelper.NpgNormal_GetListDic(sectionPointsSql, pgUrl, pgUserName, pgPassword).stream()
//                                    .map(map -> JSON.parseObject(JSON.toJSONString(map), SectionPoint.class))
//                                    .collect(Collectors.toList());
//                            gdIds.addAll(pointList.parallelStream().map(SectionPoint::getObjectid).collect(Collectors.toList()));
//                            getResult(pointList, sectionAnalysisList, resultPointList, sectionAnalysisDto, gxIds, gdIds, i, index);
//                        }
//                    }
//                }
//            }
//            sectionAnalysisVo.setSectionLineList(sectionAnalysisList);
//            sectionAnalysisVo.setSectionPointList(resultPointList);
//            return sectionAnalysisVo;
//        }
//
//    /**
//     * 计算交点，及交点埋深、高程
//     *
//     * @param wkt
//     * @param vo
//     * @throws ParseException
//     */
//    private void calIntersectionData(String wkt, CrossSectionAnalysisVo vo) throws ParseException {
//        GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null);
//        //雨水污水以管底计算,其他按管顶计算
//        boolean flag = vo.getYsdm().startsWith("401") || vo.getYsdm().startsWith("402");
//        String qdms = vo.getQdms();
//        String zdms = vo.getZdms();
//        BigDecimal qdgc = vo.getQdgc();
//        BigDecimal zdgc = vo.getZdgc();
//        String gj = vo.getGj();
//        double gjDouble = Double.parseDouble(gj);
//        BigDecimal gjDecimal = BigDecimal.valueOf(gjDouble);
//        String gxShapeText = vo.getCoordinate();
//        WKTReader reader = new WKTReader(geometryFactory);
//        Geometry lrrlGeom = reader.read(wkt);
//        Geometry gxGeom = reader.read(gxShapeText);
//        LineString lrrlLineString = (LineString) lrrlGeom;
//        LineString gxLineString = null;
//        if (gxGeom instanceof MultiLineString) {
//            MultiLineString var2 = (MultiLineString) gxGeom;
//            gxLineString = (LineString) var2.getGeometryN(0);
//        } else if (gxGeom instanceof LineString) {
//            gxLineString = (LineString) gxGeom;
//        }
//        Geometry intersectionPoint = lrrlLineString.intersection(gxLineString);
//        Point startPoint = gxLineString.getStartPoint();
//        Point endPoint = gxLineString.getEndPoint();
//        double length = gxLineString.getLength();
//        double distance = startPoint.distance(intersectionPoint);
//        vo.setIntersectionPoint(intersectionPoint.toString());
//        if (!StringUtils.isEmpty(qdms) && !StringUtils.isEmpty(zdms)) {
//            BigDecimal qdmsDouble = BigDecimal.valueOf(Double.parseDouble(qdms));
//            BigDecimal zdmsDouble = BigDecimal.valueOf(Double.parseDouble(zdms));
//
//            if (flag) {
//                qdmsDouble = qdmsDouble.subtract(gjDecimal.divide(BigDecimal.valueOf(1000), MathContext.DECIMAL64));
//                zdmsDouble = zdmsDouble.subtract(gjDecimal.divide(BigDecimal.valueOf(1000), MathContext.DECIMAL64));
//            }
//            BigDecimal var1 = zdmsDouble.subtract(qdmsDouble);
//            BigDecimal var2 = BigDecimal.valueOf(distance).divide(BigDecimal.valueOf(length), MathContext.DECIMAL64).min(var1);
//            BigDecimal var3 = qdmsDouble.add(var2);
//            vo.setIntersectionMs(var3.doubleValue());
//        }
//        if (qdgc != null && zdgc != null) {
//            if (!flag) {
//                qdgc = qdgc.subtract(gjDecimal.divide(BigDecimal.valueOf(1000), MathContext.DECIMAL64));
//                zdgc = zdgc.subtract(gjDecimal.divide(BigDecimal.valueOf(1000), MathContext.DECIMAL64));
//            }
//            //高程差
//            BigDecimal var4 = zdgc.subtract(qdgc);
//            //计算比例
//            BigDecimal var5 = BigDecimal.valueOf(distance).divide(BigDecimal.valueOf(length), MathContext.DECIMAL64).min(var4);
//            //交点高程
//            BigDecimal var6 = qdgc.add(var5);
//
//            //保存交点高程
//            vo.setIntersectionGc(var6.doubleValue());
//        }
//    }
//
//    private CrossSectionAnalysisVo calculationVerticalDistance(LineString line1, LineString line2, CrossSectionAnalysisVo crossSection) {
//        Geometry interPoint = line1.intersection(line2);// 相交点
//        //相交点到管线的距离,算出的是度
//        double line1Distance = line1.getStartPoint().distance(interPoint);
//        //相交点到线2的距离
//        BigDecimal line2Distance = BigDecimal.valueOf(line2.getStartPoint().distance(interPoint));
//        //线2的长度
//        BigDecimal line2Length = BigDecimal.valueOf(line2.getLength());
//        //占比
//        BigDecimal ratio2 = line2Distance.divide(line2Length, RoundingMode.HALF_UP);
//        // 计算相交管线的管点高程、覆土深度，v1abs是高程差；
//        if (crossSection.getQdgc() != null && crossSection.getZdgc() != null) {
//            //起点高程-终点高程
//            BigDecimal gcAbs = (crossSection.getQdgc().subtract(crossSection.getZdgc()));
//            BigDecimal gc = crossSection.getZdgc()
//                    .add((gcAbs.multiply(ratio2)));
//            crossSection.setPointGc(gc);
//        }
//        if (crossSection.getGxqdfthd() != null && crossSection.getGxzdfthd() != null) {
//            BigDecimal ftAbs = (crossSection.getGxqdfthd().subtract(crossSection.getGxzdfthd()));
//            BigDecimal ms = crossSection.getGxzdfthd()
//                    .add((ftAbs.multiply(ratio2)));
//            crossSection.setPointMs(ms);
//        } else {
//            BigDecimal ftAbs = (BigDecimal.valueOf(Double.valueOf(crossSection.getQdms())).subtract(BigDecimal.valueOf(Double.valueOf(crossSection.getZdms()))));
//
//            BigDecimal ms = BigDecimal.valueOf(Double.valueOf(crossSection.getQdms()))
//                    .add((ftAbs.multiply(ratio2)));
//            crossSection.setPointMs(ms);
//        }
//        //获取划线起点与相交管线的距离,转成米
//        BigDecimal distance = BigDecimal.valueOf(0);
//        if (interPoint.getSRID() != 0) {
//            distance = BigDecimal.valueOf(line1Distance).multiply(BigDecimal.valueOf(VAL));
//        } else {
//            distance = BigDecimal.valueOf(line1Distance);
//        }
//        crossSection.setDistance(distance);
//        return crossSection;
//    }
//
//    //经纬度坐标转4549
//    public String getCoordinate4549(String text) {
//        String sql = "select st_astext(st_transform(sde.st_geometry('" + text + "',4490), 4528))";
//        String result = DBHelper.NpgNormal_GetScalar(sql, pgUrl, pgUserName, pgPassword).toString();
//        return result;
//    }
//
//    //4549坐标转经纬度
//    public String getCoordinateJWD(String text) {
//        String sql = "select st_astext( st_transform(sde.st_geometry('" + text + "',4528), 4490))";
//        String result = DBHelper.NpgNormal_GetScalar(sql, pgUrl, pgUserName, pgPassword).toString();
//        return result;
//    }
//
//    //参数优化:表明转换成id
//    public List<Integer> tableParse(List<String> tables) {
//        List<Integer> integerList = new ArrayList<>();
//        for (String table : tables) {
//            String sql = "SELECT id FROM sys_result_tem where note='" + table + "'";
//            String result = DBHelper.NpgNormal_GetScalar(sql, pgUrl, pgUserName, pgPassword).toString();
//            integerList.add(Integer.parseInt(result));
//        }
//        return integerList;
//    }
//
//    //计算两点距离
//    public Object calcDistance(String spatialDtoWKT) {
//        String points[] = spatialDtoWKT.split(",");
//        int index = points[0].indexOf("(");
//        String point1 = points[0].substring(index + 1);
//        String point2 = points[1].replace(")", "");
//        String sql = "SELECT sde.ST_Distance(sde.st_transform(sde.st_geometry('POINT(" + point1 + ")',4490), 4528),sde.st_transform(sde.st_geometry('POINT(" + point2 + ")',4490), 4528))";
//        Object result = DBHelper.NpgNormal_GetScalar(sql, pgUrl, pgUserName, pgPassword).toString();
//        return result;
//    }
//
//}
